﻿@{
    ViewBag.Title = "Administrator";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
<div class="widget">
    <div class="widget-content">
        <div class="padd" id="loading">
            <canvas id="trChart" width="400" height="400"></canvas>
        </div>
    </div>
</div>
@section scripts{
    <script type="text/javascript">
        function createChart() {
            //$('#loading').html('<img src="http://preloaders.net/preloaders/287/Filling%20broken%20ring.gif"> loading...');
            var data = {
                "datasets":
                    [{ "fillColor": "rgba(225,25,0,1)", "strokeColor": "rgba(225,25,0,1)", "data": [65] }],
                "labels": [" ok"]
            }
            var cht = document.getElementById('trChart');
            var ctx = cht.getContext('2d');
            var barChart = new Chart(ctx).Bar(data);
            $.ajax({
                url: "/Admin/Home/Test?fillColor='rgba(225,0,0,1)'",
                type: "POST",
                success: function (data) {
                    debugger;
                    alert(data.datasets.data.length);
                    for (var i = 0; i < data.datasets.data.length - 1; i++)
                        barChart.addData([data.datasets.data[i]], data.labels[i]);
                    barChart.removeData();
                    //setTimeout(function () {
                    //    $('#loading').html('No Data Available');
                    //}, 2000);
                },
                error: function (data) {
                }
            });
        }

        $(document).ready(function () {
            $('#h2Title').html("<i class='fa fa-home'></i> Dash Board");
            $('#aTitle').html("Admin Home");
            $('#liDashboard').addClass("open");
         //   createChart();
        });
    </script>
}
